package cn.jy.nvr.utils;

import java.io.IOException;
import org.apache.tomcat.util.codec.binary.Base64;
public class ImageUtils {
  public  static	byte[] getByte(byte[] value) throws IOException {
		byte[] c = null;
		if (null != value) {
			java.io .ByteArrayInputStream bin = new java.io .ByteArrayInputStream(value);
			try {
				java.io .DataInputStream in = new java.io .DataInputStream(bin);
				try {
					in.readUTF();
					in.readUTF();
					in.readInt();
					c = new byte[in.available()];
					in.read(c, 0, c.length);
				} finally {
					in.close();
				}
			} finally {
				bin.close();
			}
		}
		return c;
	}

  
  public static byte[] base64String2ByteFun(String base64Str){  
      return Base64.decodeBase64(base64Str);  
  }  
  //byte[]转base64  
  public static String byte2Base64StringFun(byte[] b){  
      return Base64.encodeBase64String(b);  
  }  
}


